package com.shrcl.engineerprocess.domain.proxy;

import com.google.gwt.user.client.rpc.IsSerializable;
import com.shrcl.engineerprocess.domain.proxy.EngineerProjectAssignmentAction;

public class EngineerProjectAssignmentManager implements IsSerializable {
  public static Boolean isActionValid(final EngineerProjectAssignmentAction action, final String state) {
    if(action==null||state==null) return false;
    switch(action){
    	case checkExecutingTimer:{
    		return "created".equals(state);
    	}
    	case startExecute:{
    		return "created".equals(state);
    	}
    	case finish:{
    		return "executing".equals(state);
    	}
    	case updateV:{
    		return "executing".equals(state);
    	}
    	case doSummary:{
    		return "executing".equals(state);
    	}
    	case cancel:{
    		return "created".equals(state)||"executing".equals(state);
    	}
    	default:
    		return false;
    }
    
  }
  
  public static Boolean isActionValid(final EngineerProjectAssignmentAction action, final Enum<?> state) {
    return isActionValid(action,state.name());
    
  }
}
